package make

import (
	"github.com/runningwater/gohub/pkg/console"
	"github.com/spf13/cobra"
)

var CmdMakeSeeder = &cobra.Command{
	Use:   "seeder",
	Short: "Create model's seeder file, example: make seeder user",
	Run:   runMakeSeeder,
	Args:  cobra.ExactArgs(1),
}

func runMakeSeeder(cmd *cobra.Command, args []string) {
	model := makeModelFromString(args[0])

	filePath := "database/seeders/" + model.PackageName + "_seeder.go"

	createFileFromTpl(filePath, "seeder", model)
	console.Success("Seeder file created successfully: " + filePath)
	// 提示用户需要在 database/seeders/init.go 中注册 Seeder
	console.Warning("Please register the seeder in database/seeders/init.go")
}
